package org.ns.longhttp.selector.datamapper;

/**
 * 应答实体的包装
 */
public class DataResponseEntryWrapper {

    private DataResponseEntry dataResponseEntry; // 应答的实体
    private long invalidTime;   // 失效的时间戳 毫秒时间戳

    public DataResponseEntryWrapper(DataResponseEntry dataResponseEntry, long invalidTime) {
        this.dataResponseEntry = dataResponseEntry;
        this.invalidTime = invalidTime;
    }

    /**
     * 判断是否失效
     * @return
     */
    public boolean isInvalid() {
        return System.currentTimeMillis() > invalidTime;
    }

    public DataResponseEntry getDataResponseEntry() {
        return dataResponseEntry;
    }
}
